\(\int \frac {3+x^2}{-3+x^2} \, dx\) [45]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 17 \[ \int \frac {3+x^2}{-3+x^2} \, dx=x-2 \sqrt {3} \text {arctanh}\left (\frac {x}{\sqrt {3}}\right ) \]

[Out]

x-2*arctanh(1/3*x*3^(1/2))*3^(1/2)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {396, 213} \[ \int \frac {3+x^2}{-3+x^2} \, dx=x-2 \sqrt {3} \text {arctanh}\left (\frac {x}{\sqrt {3}}\right ) \]

[In]

Int[(3 + x^2)/(-3 + x^2),x]

[Out]

x - 2*Sqrt[3]*ArcTanh[x/Sqrt[3]]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps \begin{align*} \text {integral}& = x+6 \int \frac {1}{-3+x^2} \, dx \\ & = x-2 \sqrt {3} \tanh ^{-1}\left (\frac {x}{\sqrt {3}}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.94 \[ \int \frac {3+x^2}{-3+x^2} \, dx=x+\sqrt {3} \log \left (\sqrt {3}-x\right )-\sqrt {3} \log \left (\sqrt {3}+x\right ) \]

[In]

Integrate[(3 + x^2)/(-3 + x^2),x]

[Out]

x + Sqrt[3]*Log[Sqrt[3] - x] - Sqrt[3]*Log[Sqrt[3] + x]

Maple [A] (verified)

Time = 3.42 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88

method result size
default \(x -2 \,\operatorname {arctanh}\left (\frac {\sqrt {3}\, x}{3}\right ) \sqrt {3}\) \(15\)
risch \(x +\sqrt {3}\, \ln \left (x -\sqrt {3}\right )-\sqrt {3}\, \ln \left (x +\sqrt {3}\right )\) \(26\)
meijerg \(-\operatorname {arctanh}\left (\frac {\sqrt {3}\, x}{3}\right ) \sqrt {3}-\frac {i \sqrt {3}\, \left (\frac {2 i \sqrt {3}\, x}{3}-2 i \operatorname {arctanh}\left (\frac {\sqrt {3}\, x}{3}\right )\right )}{2}\) \(38\)

[In]

int((x^2+3)/(x^2-3),x,method=_RETURNVERBOSE)

[Out]

x-2*arctanh(1/3*3^(1/2)*x)*3^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.53 \[ \int \frac {3+x^2}{-3+x^2} \, dx=\sqrt {3} \log \left (\frac {x^{2} - 2 \, \sqrt {3} x + 3}{x^{2} - 3}\right ) + x \]

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="fricas")

[Out]

sqrt(3)*log((x^2 - 2*sqrt(3)*x + 3)/(x^2 - 3)) + x

Sympy [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.59 \[ \int \frac {3+x^2}{-3+x^2} \, dx=x + \sqrt {3} \log {\left (x - \sqrt {3} \right )} - \sqrt {3} \log {\left (x + \sqrt {3} \right )} \]

[In]

integrate((x**2+3)/(x**2-3),x)

[Out]

x + sqrt(3)*log(x - sqrt(3)) - sqrt(3)*log(x + sqrt(3))

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.29 \[ \int \frac {3+x^2}{-3+x^2} \, dx=\sqrt {3} \log \left (\frac {x - \sqrt {3}}{x + \sqrt {3}}\right ) + x \]

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="maxima")

[Out]

sqrt(3)*log((x - sqrt(3))/(x + sqrt(3))) + x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 30 vs. \(2 (14) = 28\).

Time = 0.29 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.76 \[ \int \frac {3+x^2}{-3+x^2} \, dx=\sqrt {3} \log \left (\frac {{\left | 2 \, x - 2 \, \sqrt {3} \right |}}{{\left | 2 \, x + 2 \, \sqrt {3} \right |}}\right ) + x \]

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="giac")

[Out]

sqrt(3)*log(abs(2*x - 2*sqrt(3))/abs(2*x + 2*sqrt(3))) + x

Mupad [B] (verification not implemented)

Time = 5.41 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82 \[ \int \frac {3+x^2}{-3+x^2} \, dx=x-2\,\sqrt {3}\,\mathrm {atanh}\left (\frac {\sqrt {3}\,x}{3}\right ) \]

[In]

int((x^2 + 3)/(x^2 - 3),x)

[Out]

x - 2*3^(1/2)*atanh((3^(1/2)*x)/3)